
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
   <link rel="stylesheet" type="text/css" href="Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="Css/style.css" />
    <script type="text/javascript" src="js/jquery2.js"></script>
   <!--  <script type="text/javascript" src="js/jquery2.sorted.js"></script> -->
    <script type="text/javascript" src="js/bootstrap.js"></script>
    <script type="text/javascript" src="js/ckform.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
	<script type="text/javascript" src="js/main.js"></script>
	<script type="text/javascript" src="js/tableExporter.js"></script>
	
	<script type="text/javascript" src="js/tablesort.min.js"></script>
	<script type="text/javascript" src="js/tablesort.number.js"></script>
	

	
    <style type="text/css">
        body {font-size: 20px;
            padding-bottom: 40px;
            background-color:#e9e7ef;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
	

    </style>
</head>
<body>
<form class="form-inline definewidth m20" >
	<input type="text" name="notautosubmit"style="display:none"/>
    <font color="#777777"><strong>请输入筛选条件：</strong></font>
    <input type="text" onkeydown="keyDown(event)" id="coLLn"class="abc input-default" placeholder="请输入文件名称" value="">&nbsp;&nbsp; 
    <button type="button" class="btn btn-primary" onclick="searchData()">查询</button>&nbsp;&nbsp; 
    <button type="button" class="btn btn-primary" onclick="exportTo('txt');" href="javascript://">导出TXT <span class="caret"></span></button>
</form>

  	<!-- table table-bordered table-hover definewidth m10  -->
<table class="table table-bordered table-hover definewidth m10" id="table-id" >
    <thead>
    <tr id="head">

    </tr>
    </thead>
   
    <tbody id ="con"></tbody>
    
 </table>

</body>
</html>
<script>
	function getURLParameter(name) {
	    return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
	}
	

	
    var file_name=getURLParameter('file_name');
 	
    var clot = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP')
    clot.open('GET', '/fileSys/FileDetailServlet?file_name='+file_name+'', true);
    clot.send();
    clot.onreadystatechange = function () {
        if (clot.readyState == 4 && clot.status == 200) {
   
            var result = JSON.parse(clot.responseText);
            if(result.msg!=0){
            	alert(result.msg);
            	top.location.href="/fileSys/login.html"; 
            }
            
            var title =result.title;
            var head = document.getElementById('head');
            var headHtml='';
            for(var i= 0;i<title.length;i++){
            	headHtml+='<th>'+title[i]+'</th>';
            }
            head.innerHTML = headHtml;
            
            
            
            var data =result.list;
            var html = '';
            var con = document.getElementById('con');
            for (var i = 0; i < data.length; i++) {
            	html += '<tr><td>'+i+'</td>';
            	for (var j = 0; j < data[i].length; j++){
            		
                	html += '<td>'+data[i][j]+'</td>';
            
            	}
            	html+='</tr>';
            }
            con.innerHTML = html;
            
            new Tablesort(document.getElementById('table-id'));
        	
        }
    }
    function searchData(){
		var name=document.getElementById('coLLn');
		if(name.value!=undefined&&name.value!=null&&name.value!=""){
			clot.open('GET', '/fileSys/FileDetailServlet?file_name='+name.value+'', true);
		}else{
			clot.open('GET', '/fileSys/FileDetailServlet?file_name='+file_name+'', true);
		}
		
	    clot.send();
		
	}
    function keyDown(e) {
    	  var ev= window.event||e;
    	  if (ev.keyCode == 13) {
    	   searchData();
    	  }
   	}



	
</script>
